package com.ssy.lingxi.report.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 *  合同管理操作类型枚举
 * @author ds
 * @date 2021/5/11
 * @version 2.0.0
 */
public enum ContractManageOperateTypeEnum {

    TO_BE_CREATE_INQUIRY(1, "待创建采购询价合同", "/memberCenter/contract/manage/purchase"),
    TO_BE_CREATE_VIE_PRICE(2, "待创建采购竞价合同", "/memberCenter/contract/manage/Auction"),
    TO_BE_CREATE_INVITE_TENDER(3, "待创建采购招标合同", "/memberCenter/contract/manage/bidding"),
    TO_BE_COMMIT(4, "待提交合同", "/memberCenter/contract/manage/add/addList"),
    TO_BE_COMMIT_VALIFY(5, "待提交审核合同", "/memberCenter/contract/manage/examine"),
    TO_BE_VALIFY_STEP1(6, "待审核合同（一级）","/memberCenter/contract/manage/levelexamine"),
    TO_BE_VALIFY_STEP2(7, "待审核合同（二级）","/memberCenter/contract/manage/secondaryexamine"),
    TO_BE_SIGN(8, "待签订合同","/memberCenter/contract/manage/signacontract"),
    ;
    /**
     * 编码
     */
    private final Integer code;
    /**
     * 名称
     */
    private final String name;
    /**
     * 链接
     */
    private final String link;


    ContractManageOperateTypeEnum(Integer code, String name, String link) {
        this.code = code;
        this.name = name;
        this.link = link;
    }

    public static ContractManageOperateTypeEnum getEnum(Integer code) {
        return Arrays.stream(ContractManageOperateTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }


    public Integer getCode() {
        return code;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public String getLink() {
        return link;
    }
}
